package cn.lingnan.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@Controller
@RequestMapping("order/consumer")
public class OrderConsumerController {

    @Autowired
    private RestTemplate restTemplate;

    String url_prefix="http://provider-order";

    @GetMapping(value="/toOrderList")
    public String toOrderList(Model model){
        System.out.println("::::::::::::::::::::::");
        String url = url_prefix+"/order/findOrderLimit";
        List list = restTemplate.getForObject(url, List.class);
        model.addAttribute("order",list);
        return "tgls/reportForm/order_list";
    }




}
